home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
CRS
/
crs08.d81
/
vcr-plus.sfx
/
decode
/
code.bas
(
.txt
)
Wrap
Commodore BASIC
|
1990-02-12
|
9KB
|
346 lines
5 POKE53280,0:POKE53281,0:PRINT"[159][147]":GOSUB2000
10 PRINT"[147][214][195][210]+ [196]ECODER/[195]ODER":PRINT
11 PRINT"[207]RIGINAL [195] SOURCE CODE BY:"
12 PRINT" ???":PRINT
13 PRINT"[201]MPROVED AND CONVERTED TO [212]URBO[194]ASIC[216][204]"
14 PRINT"FOR THE [193]TARI 8 BIT BY:"
15 PRINT" [202]OHN [211]. [205]CGOWAN - [202].[205][195][199][207][215][193][206]15 ON [199][197]NIE";:PRINT
16 PRINT"[195]ONVERTED TO [195]OMMODORE [194][193][211][201][195] BY:"
17 PRINT" [202]ON [199]. [208]URKEY - [199][213][204][204][201][194][204][197] ON [199][197]NIE & [209]":PRINT
18 PRINT"[201]NITIALIZING...":PRINT
20 GOSUB1500
30 PRINT"[196]: [196]ECODE ([196]ECODE A [214][195][210]+ CODE)"
32 PRINT"[195]: [195]ODE ([195]REATE A [214][195][210]+ CODE)":PRINT
34 INPUT"[197]NTER [196]:[196]ECODE OR [195]:[195]ODE C[157][157][157]";X$
40 IFX$<>"C"ANDX$<>"D"ANDX$<>"[196]"ANDX$<>"[195]"THENPRINT" *[197][210][210][207][210]* - [197]NTER [196] OR [195]":GOTO34
45 IFX$="D"ORX$="[196]"THENX=1
46 IFX$="C"ORX$="[195]"THENX=2
50 ONXGOSUB530,80
60 PRINT:GOTO30
70 :
80 PRINT"[147] - [195][207][196][197] -":PRINT
90 INPUT"[217]EAR";YE
92 IFYE<>INT(YE)THENPRINT" *[197][210][210][207][210]* - [197]NTER 93, 1993, ETC.":GOTO90
100 INPUT"[205]ONTH";MO
102 IFMO<>INT(MO)ORMO>12ORMO<1THENPRINT" *[197][210][210][207][210]* - [197]NTER 1-12":GOTO100
110 INPUT"[196]AY";DA
112 IFDA<>INT(DA)ORDA>31ORDA<1THENPRINT" *[197][210][210][207][210]* - [197]NTER 1-31":GOTO110
120 INPUT"[195]HANNEL 1-64";CH:CV=CH-1
122 IFCH<>INT(CH)ORCH<1ORCH>64THENPRINT" *[197][210][210][207][210]* - [197]NTER 1-64":GOTO120
130 PRINT"[197]NTER STARTING TIME IN 24 HOUR FORMAT."
132 PRINT"[200][200][205][205] (0700, 2330, ETC.) [205]UST BE ON AN"
134 INPUT"EVEN HALF HOUR";H$
136 HR=VAL(H$)/100:IFHR>24ORHR<0THENPRINT" *[197][210][210][207][210]* - [201]NVALID FORMAT":GOTO130
138 IFRIGHT$(H$,2)<>"00"ANDRIGHT$(H$,2)<>"30"THENPRINT" *[197][210][210][207][210]* - [201]NVALID FORMAT":GOTO130
140 PRINT"[197]NTER DURATION IN MINUTES. [205]UST BE AN "
141 INPUT"EVEN 30 MINUTES";DU
142 IFDU<30ORDU>300ORINT(DU/30)<>DU/30THENPRINT" *[197][210][210][207][210]* -[160][197]NTER 30, 90, ETC.":GOTO140
143 PRINT:PRINT"[215]ORKING..."
210 IFINT(HR)=24THENHR=HR-24:DA=DA+1:IFDA=32THENDA=1:MO=MO+1:IFMO=13THENMO=1:YE=YE+1
220 YS=YE:YE=YE-100*INT(YE/100):YE=YE-16*INT(YE/16):TD=INT(HR)*2
230 IFRIGHT$(H$,2)="30"THENTD=TD+1
240 TD=10*TD+INT(DU/30)-1:TL=A1(TD)
250 GOSUB1150:A1=A
260 IFA=0THENT2=0:OF=0:GOTO340
290 D=1+INT(LOG(A)/LOG(10)):FORI=0TOD-1: P(D-I-1)=A-10*INT(A/10):A=INT(A/10)
300 NEXTI:GOSUB 1370
310 T2=0:FORI=0TOD-1:T2=T2+INT(P(D-I-1)*10^I+0.5):NEXT I
320 GOSUB 1290
330 A=0:FORI=0TOD-1:A=A+INT(P(D-I-1)*10^I+ 0.5):NEXT I
335 IFA<>A1THENPRINT" *[197][210][210][207][210] IN CALCULATIONS*"
340 :
350 Q=DA-1:RE=(B-DA*(MO+1)-OF)-32*INT((B-DA*(MO+1)-OF)/32):IFRE<0THENRE=RE+32
360 B2=Q*32+RE+1:B1=B2
370 FORI=0TO2:C(I)=B2-10*INT(B2/10):B2=INT(B2/10):NEXTI
380 T1=T2
390 IFT2<>0THENFORI=0TOD-1:C(I+3)=T2-10*INT(T2/10):T2=INT(T2/10):NEXTI
400 IFT1<>0THEND=D+3
410 IFT1=0THEND=1+INT(LOG(B1)/LOG(10))
420 GOSUB1010
430 C=0:FORI=0TOD-1:C=C+INT(C(I)*10^I+0.5):NEXTI
431 HR=VAL(H$):P$="[208][205]":IFHR<1200THENP$="[193][205]"
432 IFHR>1259THENHR=HR-1200
433 IFHR<100THENHR=HR+1200
434 H$=STR$(HR):IFLEN(H$)=4THENH$=MID$(H$,2,1)+":"+RIGHT$(H$,2):GOTO440
435 H$=MID$(H$,2,2)+":"+RIGHT$(H$,2)
440 PRINT
450 PRINT" [214][195][210]+ CODE:"C
460 PRINT
470 PRINT" [196]ATE:"MO"/"DA"/"YS
480 PRINT" [212]IME: "H$" "P$
490 PRINT" [196]URATION:"DU"MINUTES"
500 PRINT" [195]HANNEL:"CH
510 RETURN
520 :
530 :
540 PRINT"[147] - [196][197][195][207][196][197] -":PRINT
541 INPUT"[217]EAR";YE:YS=YE
542 IFYE<>INT(YE)THENPRINT" *[197][210][210][207][210]* - [197]NTER 1993, 93, ETC.":GOTO541
550 INPUT"[205]ONTH";MO
552 IFMO<>INT(MO)ORMO<1ORMO>12THENPRINT" *[197][210][210][207][210]* - [197]NTER 1-12":GOTO550
560 INPUT"[214][195][210]+ CODE";C:CS=C
570 D=1+INT(LOG(C)/LOG(10)):IFD>8THENPRINT" *[197][210][210][207][210]* - [197]NTER 1-999999":GOTO560
575 PRINT:PRINT"[215]ORKING..."
600 FORI=0TOD-1:C(I)=C-10*INT(C/10):C=INT(C/10):NEXTI
610 GOSUB920
620 N=D-1:X=0:FORI=0TON
630 X=X+C(I)*INT(10^I+0.5)
640 NEXTI
650 YE=YE-100*INT(YE/100):YE=YE-16*INT(YE/16)
660 B2=X-1000*INT(X/1000)
670 T2=INT(X/1000)
680 Q=INT((B2-1)/32)
690 RE=(B2-1)-32*INT((B2-1)/32)
700 DA=Q+1
710 IFT2<=0THENA=0:OF=0:GOTO820
720 D=1+INT(LOG(T2)/LOG(10))
730 FORJ=0TOD-1
740 P(D-1-J)=T2-10*INT(T2/10)
745 T2=INT(T2/10)
750 NEXTJ
760 GOSUB1290
770 A=0:FORJ=0TOD-1
780 A=A+P(D-1-J)*INT(10^J+0.5):NEXTJ:GOTO820
820 B=(RE+DA*(MO+1)+OF)-32*INT((RE+DA*(MO+1)+OF)/32)
830 GOSUB1100
840 CH=CV+1:TD=A2(TL)
842 DU=30*(TD-10*INT(TD/10))+30
843 HL=INT(TD/10):HR=INT(HL/2):MI=30*(HL-2*INT(HL/2))
844 HR=HR*100:IFMI>0THENHR=HR+MI
845 P$="[208][205]":IFHR<1200THENP$="[193][205]"
846 IFHR>1259THENHR=HR-1200
847 IFHR<100THENHR=HR+1200
848 H$=STR$(HR):IFLEN(H$)=4THENH$=MID$(H$,2,1)+":"+RIGHT$(H$,2):GOTO850
849 H$=MID$(H$,2,2)+":"+RIGHT$(H$,2)
850 PRINT
855 PRINT" [214][195][210]+ CODE:"CS
860 PRINT
865 PRINT" [196]ATE:"MO"/"DA"/"YS
870 PRINT" [212]IME: "H$" "P$
875 PRINT" [196]URATION:"DU"MINUTES"
880 PRINT" [195]HANNEL:"CH
885 RETURN
900 :
910 :
920 :
930 N=D-1
940 FORI=0TON:TE(I)=0:NEXTI
950 FORI=0TON:FORJ=0TON-I
960 TE(I+J)=TE(I+J)+Q(I)*C(J):NEXTJ:NEXTI
970 FORI=0TON:C(I)=TE(I)-10*INT(TE(I)/10):NEXTI
980 IFC(N)=0THEN940
990 RETURN
1000 :
1010 :
1020 N=D-1
1030 FORI=0TON:TE(I)=0:NEXTI
1040 FORI=0TON:FORJ=0TON-I
1050 TE(I+J)=TE(I+J)+QI(I)*C(J):NEXTJ:NEXTI
1060 FORI=0TON:C(I)=TE(I)-10*INT(TE(I)/10):NEXTI
1070 IFC(N)=0THEN1030
1080 RETURN
1090 :
1100 :
1110 TL=(AAND512)/2+(AAND128)+(AAND32)*2+(AAND16)*2+(AAND8)*2
1115 TL=TL+(AAND1)*8+(BAND16)/4+(BAND4)/2+(BAND1)
1120 CV=(AAND256)/8+(AAND64)/4+(AAND4)*2+(AAND2)*2+(BAND8)/4+(BAND2)/2
1130 RETURN
1140 :
1150 :
1160 A=(TLAND256)*2+(CVAND32)*8+(TLAND128)+(CVAND16)*4+(TLAND64)/2
1165 A=A+(TLAND32)/2+(TLAND16)/2+(CVAND8)/2+(CVAND4)/2+(TLAND8)/8
1170 B=(TLAND4)*4+(CVAND2)*4+(TLAND2)*2+(CVAND1)*2+(TLAND1)
1180 RETURN
1190 :
1200 :
1210 PO(0)=1:PO(1)=Y+1
1212 PO(2)=(Y+2)*PO(1)/2
1214 PO(3)=(Y+3)*PO(2)/3
1216 PO(4)=(Y+4)*PO(3)/4
1218 PO(5)=(Y+5)*PO(4)/5
1220 FORI=0TON:TE(I)=0:NEXTI
1230 FORI=0TON:FORJ=0TON-I
1240 TE(I+J)=TE(I+J)+PO(I)*P(J)
1250 NEXTJ:NEXTI
1260 FORI=0TON:TE(I)=(TE(I)+DA*PO(I+1))-10*INT((TE(I)+DA*PO(I+1))/10):NEXTI
1270 RETURN
1280 :
1290 :
1300 N=D-1:OF=0
1310 FORI=0TON:OF=OF+P(I):NEXTI
1320 FORY=0TOYE:GOSUB1200:OF=OF+TE(N):NEXTY
1330 FORI=0TON:P(I)=TE(I):NEXTI
1340 IFP(0)=0THEN1320
1350 RETURN
1360 :
1370 :
1380 PO(0)=1:PO(1)=-(YE+1)
1382 PO(2)=-YE*PO(1)/2
1384 PO(3)=-(YE-1)*PO(2)/3
1390 PO(4)=-(YE-2)*PO(3)/4
1392 PO(5)=-(YE-3)*PO(4)/5
1400 N=D-1
1410 FORI=0TON:TE(I)=0:NEXTI
1420 FORI=0TON:FORJ=0TON-I
1430 TE(I+J)=TE(I+J)+PO(I)*P(J)
1440 NEXTJ:NEXTI
1450 FORI=0TON:
1452 P(I)=(TE(I)+DA*PO(I+1))-10*INT((TE(I)+DA*PO(I+1))/10)
1454 IFP(I)<0THENP(I)=10+P(I)
1460 NEXTI
1470 IFP(0)=0THEN1410
1480 RETURN
1490 :
1500 :
1510 DATA 370,320,390,330,310
1512 DATA 350,360,290,380,341,280
1514 DATA 410,340,323,400,300,403
1516 DATA 423,401,363
1520 DATA 381,441,421,283,301
1522 DATA 443,230,220,460,321,422
1524 DATA 420,250,270,190,261,430
1526 DATA 241,203,361
1530 DATA 440,240,160,170,343
1532 DATA 180,450,210,383,150,461
1534 DATA 201,140,260,143,221,281
1536 DATA 200,163,470
1540 DATA 263,243,183,130,362
1542 DATA 120,110,0,473,442,262,181
1544 DATA 332,322,292,402,372,121
1546 DATA 242,10
1550 DATA 33,1,342,3,161,141
1552 DATA 433,100,312,233,223,172
1554 DATA 452,182,432,333,471,23
1556 DATA 282,30
1560 DATA 73,302,303,463,382
1562 DATA 162,90,60,273,202,142,20
1564 DATA 472,70,40,453,80,123,83
1566 DATA 50
1570 DATA 132,11,451,21,13
1572 DATA 462,331,171,2,393,193,412
1574 DATA 101,351,43,392,192,353
1576 DATA 133,371
1580 DATA 291,232,12,173,212
1582 DATA 293,22,153,413,62,63,272
1584 DATA 252,52,431,231,373,131
1586 DATA 111,41
1590 DATA 313,151,122,352,81
1592 DATA 152,92,91,32,253,31,53
1594 DATA 391,61,213,42,71,103,191
1596 DATA 51
1600 DATA 411,82,311,93,271
1602 DATA 251,72,211,102,113,112
1604 DATA 222,474,464,454,444,434
1606 DATA 424,414,404
1610 DATA 394,384,374,364,354
1612 DATA 344,334,324,314,304,294
1614 DATA 284,274,264,254,244,234
1616 DATA 224,214,204
1620 DATA 194,184,174,164,154
1622 DATA 144,134,124,114,104,94,84
1624 DATA 74,64,54,44,34,24,14,4
1630 DATA 475,465,455,445,435
1632 DATA 425,415,405,395,385,375
1634 DATA 365,355,345,335,325,315
1636 DATA 305,295,285
1640 DATA 275,265,255,245,235
1642 DATA 225,215,205,195,185,175
1644 DATA 165,155,145,135,125,115
1646 DATA 105,95,85
1650 DATA 75,65,55,45,35,25
1652 DATA 15,5,476,466,456,446,436
1654 DATA 426,416,406,396,386,376
1656 DATA 366
1660 DATA 356,346,336,326,316
1662 DATA 306,296,286,276,266,256
1664 DATA 246,236,226,216,206,196
1666 DATA 186,176,166
1670 DATA 156,146,136,126,116
1672 DATA 106,96,86,76,66,56,46,36
1674 DATA 26,16,6,477,467,457,447
1680 DATA 437,427,417,407,397
1682 DATA 387,377,367,357,347,337
1684 DATA 327,317,307,297,287,277
1686 DATA 267,257,247
1690 DATA 237,227,217,207,197
1692 DATA 187,177,167,157,147,137
1694 DATA 127,117,107,97,87,77,67
1696 DATA 57,47
1700 DATA 37,27,17,7,478,468
1702 DATA 458,448,438,428,418,408
1704 DATA 398,388,378,368,358,348
1706 DATA 338,328
1710 DATA 318,308,298,288,278
1712 DATA 268,258,248,238,228,218
1714 DATA 208,198,188,178,168,158
1716 DATA 148,138,128
1720 DATA 118,108,98,88,78,68
1722 DATA 58,48,38,28,18,8,479,469
1724 DATA 459,449,439,429,419,409
1730 DATA 399,389,379,369,359
1732 DATA 349,339,329,319,309,299
1734 DATA 289,279,269,259,249,239
1736 DATA 229,219,209
1740 DATA 199,189,179,169,159
1744 DATA 149,139,129,119,109,99,89
1746 DATA 79,69,59,49,39,29,19,9
1750 DIM A2(479),A1(479)
1760 :
1770 FORI=0TO479:READX
1772 A2(I)=X
1780 A1(X)=I:NEXTI
1790 REM GIVEN A TABLELIST VALUE=I,
1792 REM A2(I) IS THE TIME/DURATION;
1794 REM DECODE
1800 REM GIVEN A TIMEDUR=X, A1(X)
1802 REM IS THE TABLE INDEX; ENCODE
1810 REM THE DATA VALUES GIVE:
1820 REM LAST DIGIT + 1 = NUMBER
1822 REM OF HALF HOURS OF DURATION
1830 REM FIRST TWO DIGITS = NUMBER
1832 REM OF HALF HOURS FROM MIDNIGHT
1834 REM FOR SHOW TO START
1840 REM THE INDEX (PLACE IN DATA
1842 REM ARRAY) GIVES THE TABLE LOOK UP
1844 REM VALUE
1850 :
1860 DIM Q(7),QI(7)
1870 REM Q DATA, DECODE, LINE 920
1880 DATA 6,8,1,5,0,6,3,1
1890 REM QI DATA, CODE, LINE 1010
1900 DATA 0,0,0,0,9,3,7,1
1910 :
1920 FORI=7TO0STEP-1:READX
1922 Q(I)=X:NEXTI
1930 :
1940 FORI=7TO0STEP-1:READX
1942 QI(I)=X:NEXTI
1950 :
1960 DIM P(5),TE(7),PO(5)
1962 REM TABLES FOR LINE 1290 (TEMP FOR
1964 REM LINE 920 TOO!)
1970 DIM C(7)
1971 REM FOR THE CODE (8
1972 REM DIGITS), LINE 920/LINE 1010
1980 RETURN
2000 PRINT"[214][195][210]+ [196]ECODER/[195]ODER":PRINT
2010 PRINT"[196][197][195][207][196][197][210] - [212]O CONVERT A [214][195][210]+ # INTO DATE,";
2015 PRINT"TIME, CHANNEL AND DURATION.":PRINT
2020 PRINT"[195][207][196][197][210] - [212]O CREATE A [214][195][210]+ CODE FOR A"
2025 PRINT"DATE, TIME, CHANNEL AND DURATION.":PRINT
2030 PRINT"[212]IME AND DURATION MUST BE AN EVEN 30"
2035 PRINT"MINUTES. [196]URATION MAY NOT BE LONGER "
2040 PRINT"THAN 300 MINUTES.":PRINT
2045 PRINT"[195]HANNEL MUST BE BETWEEN 1-64. [201]F YOU"
2050 PRINT"NEED A HIGHER CHANNEL, THEN RE-ASSIGN"
2055 PRINT"A LOWER ONE FOLLOWING [214][195][210]+ INSTRUCTIONS.";:PRINT
2065 PRINT"[196]ECODING IS ONLY VALID ON [214][195][210]+ CODES"
2070 PRINT"FROM 1-999999.":PRINT
2075 PRINT"[201]F A 7 DIGIT [214][195][210]+ CODE IS GENERATED, IT"
2080 PRINT"WILL BE INCORRECT (POSSIBLE ON SOME 300"
2085 PRINT"MINUTE DURATIONS.) [201]F SO, THEN BREAK THE";
2090 PRINT"PROGRAM INTO TWO SEPERATE RECORDINGS.":PRINT
2095 PRINT"-[193][206][217] [203][197][217]-";
2100 GETA$:IFA$=""THEN2100
2105 RETURN